#pragma once
#include <iostream>
#include "utility/index.hpp"
#include "request_access/index.hpp"
#include "data_access/index.hpp"
#include "components/index.hpp"
#include "actions.hpp"

using namespace std;
using namespace utility;

namespace components2 {
    class ViewMaterialUseCount : public components::EntityRequest {
    public:
        COMPONENT_INSTANCE_FUNCTION(ViewMaterialUseCount);

        ViewMaterialUseCount();

        any Select2();
    };

    ViewMaterialUseCount::ViewMaterialUseCount() {
        SET_METHOD_ACTION(Select2);
    }

    any ViewMaterialUseCount::Select2() {
        QueryGroupByInfo = [&](EntityData &data, const string &whereSql, const shared_ptr<data_access::DataParameters> &parameters) -> void {
            Actions::QueryAmountGroupByInfo(shared_from_this(),data,"sum(Num) TotalNum", whereSql,parameters);
        };
        return Select();
    }
}